package com.adaxi.adc.business.vehicle.controller;

import com.adaxi.adc.business.vehicle.pojo.AdcVehicle;
import com.adaxi.adc.business.vehicle.service.AdcVehicleService;
import com.adaxi.adc.common.common.CommonResult;
import org.springframework.web.bind.annotation.*;

@RestController
public class VehicleController {
    final AdcVehicleService adcVehicleService;

    public VehicleController(AdcVehicleService adcVehicleService) {
        this.adcVehicleService = adcVehicleService;
    }

    // 查询车辆信息表
    @GetMapping("/vehicleById/{id}")
    public CommonResult<AdcVehicle> vehicleTripById(@PathVariable String id) {
        AdcVehicle vehicle = adcVehicleService.getById(id);
        return CommonResult.SUCCESS("查询成功", vehicle);
    }

    // 修改车辆信息表
    @PostMapping("/vehicleById")
    public CommonResult updatea(@RequestBody AdcVehicle vehicle) {
        adcVehicleService.saveOrUpdate(vehicle);
        return CommonResult.SUCCESS("修改成功", vehicle);
    }
}
